﻿using UnityEngine;
using System.Collections;



public enum ePlayer
{
	Left,
	Right
}

public class Player : MonoBehaviour {

	public float speed = 15f;
	public ePlayer player;
	public Vector3 playerposition;

	void Awake(){
		playerposition = transform.position;

	}

	void Update () 
	{
			float inputSpeed = 0f;
					
			if (player == ePlayer.Left)
			{
				inputSpeed = Input.GetAxisRaw ("PlayerLeft");
			}
			else if (player == ePlayer.Right)
			{
				inputSpeed = Input.GetAxisRaw ("PlayerRight");

			}

		transform.position += new Vector3(0f, 0f, Mathf.Clamp(inputSpeed * speed * Time.deltaTime,-4.3f,4.3f));
		//transform.position = playerposition;



	}
}
